
/*
 * Copyright 2002-2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 *版权所有2002-2012原作者。
 *
 *根据Apache许可证2.0版（“许可证”）获得许可；
 *除非符合许可证，否则不得使用此文件。
 *您可以在以下地址获取许可证副本：
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 *除非适用法律要求或书面同意，软件
 *根据许可证分发的内容是按“原样”分发的，
 *无任何明示或暗示的保证或条件。
 *有关管理权限和
 *许可证下的限制。
 */

package org.springframework.beans;

import java.beans.PropertyEditor;

import org.springframework.lang.Nullable;

/**
 * Encapsulates methods for registering JavaBeans {@link PropertyEditor PropertyEditors}.
 * This is the central interface that a {@link PropertyEditorRegistrar} operates on.
 *
 * <p>Extended by {@link BeanWrapper}; implemented by {@link BeanWrapperImpl}
 * and {@link org.springframework.validation.DataBinder}.
 *
 * @author Juergen Hoeller
 * @since 1.2.6
 * @see java.beans.PropertyEditor
 * @see PropertyEditorRegistrar
 * @see BeanWrapper
 * @see org.springframework.validation.DataBinder
 */
/**
 *封装用于注册JavaBeans｛@link PropertyEditor PropertyEditors｝的方法。
 *这是｛@link PropertyEditorRegister｝操作的中心接口。
 *
 *＜p＞由｛@link BeanWrapper｝扩展；由｛@link BeanWrapperImpl｝实现
 *和{@link.org.springframework.validation.DataBinder}。
 *
 *@作者Juergen Hoeller
 *@自1.2.6起
 *@参见java.beans.PropertyEditor
 *@参见PropertyEditorRegistor
 *@参见BeanWrapper
 *@参见org.springframework.validation.DataBinder
 */
public interface PropertyEditorRegistry {

	/**
	 * Register the given custom property editor for all properties of the given type.
	 * @param requiredType the type of the property
	 * @param propertyEditor the editor to register
	 */
	/**
	 *为给定类型的所有财产注册给定的自定义属性编辑器。
	 *@param requiredType属性的类型
	 *@param propertyEditor要注册的编辑器
	 */
	void registerCustomEditor(Class<?> requiredType, PropertyEditor propertyEditor);

	/**
	 * Register the given custom property editor for the given type and
	 * property, or for all properties of the given type.
	 * <p>If the property path denotes an array or Collection property,
	 * the editor will get applied either to the array/Collection itself
	 * (the {@link PropertyEditor} has to create an array or Collection value) or
	 * to each element (the {@code PropertyEditor} has to create the element type),
	 * depending on the specified required type.
	 * <p>Note: Only one single registered custom editor per property path
	 * is supported. In the case of a Collection/array, do not register an editor
	 * for both the Collection/array and each element on the same property.
	 * <p>For example, if you wanted to register an editor for "items[n].quantity"
	 * (for all values n), you would use "items.quantity" as the value of the
	 * 'propertyPath' argument to this method.
	 * @param requiredType the type of the property. This may be {@code null}
	 * if a property is given but should be specified in any case, in particular in
	 * case of a Collection - making clear whether the editor is supposed to apply
	 * to the entire Collection itself or to each of its entries. So as a general rule:
	 * <b>Do not specify {@code null} here in case of a Collection/array!</b>
	 * @param propertyPath the path of the property (name or nested path), or
	 * {@code null} if registering an editor for all properties of the given type
	 * @param propertyEditor editor to register
	 */
	/**
	 *为给定类型注册给定的自定义属性编辑器
	 *属性，或指定类型的所有财产。
	 *＜p＞如果属性路径表示数组或Collection属性，
	 *编辑器将应用于数组/集合本身
	 *（｛@link PropertyEditor｝必须创建数组或集合值）或
	 *对于每个元素（｛@code PropertyEditor｝必须创建元素类型），
	 *取决于指定的所需类型。
	 *＜p＞注意：每个属性路径只有一个注册的自定义编辑器
	 *支持。如果是集合/数组，请不要注册编辑器
	 *对于同一属性上的Collection/array和每个元素。
	 *＜p＞例如，如果您想注册“items[n].quantity”的编辑器
	 *（对于所有值n），您将使用“items.quantity”作为
	 *此方法的“propertyPath”参数。
	 *@param requiredType属性的类型。这可能是｛@code null｝
	 *如果给定了属性，但在任何情况下都应指定，特别是在
	 *集合的情况-明确编辑是否应该应用
	 *到整个集合本身或其每个条目。因此，作为一般规则：
	 *<b>如果是集合/数组，请不要在此处指定｛@code null｝</b>
	 *@param propertyPath属性的路径（名称或嵌套路径），或
	 *{@code null}如果为给定类型的所有财产注册编辑器
	 *@param propertyEditor编辑器以注册
	 */
	void registerCustomEditor(@Nullable Class<?> requiredType, @Nullable String propertyPath, PropertyEditor propertyEditor);

	/**
	 * Find a custom property editor for the given type and property.
	 * @param requiredType the type of the property (can be {@code null} if a property
	 * is given but should be specified in any case for consistency checking)
	 * @param propertyPath the path of the property (name or nested path), or
	 * {@code null} if looking for an editor for all properties of the given type
	 * @return the registered editor, or {@code null} if none
	 */
	/**
	 *查找给定类型和属性的自定义属性编辑器。
	 *@param requiredType属性的类型（如果属性为
	 *已给出，但在任何情况下都应指定以进行一致性检查）
	 *@param propertyPath属性的路径（名称或嵌套路径），或
	 *{@code null}如果为给定类型的所有财产查找编辑器
	 *@返回注册的编辑器，如果没有，则返回｛@code null｝
	 */
	@Nullable
	PropertyEditor findCustomEditor(@Nullable Class<?> requiredType, @Nullable String propertyPath);

}
